package io.bluefw.microapp.auth.repository;

import java.util.List;

import org.hibernate.SessionFactory;

import io.bluefw.microapp.auth.domain.Role;
import io.dropwizard.hibernate.AbstractDAO;

public class RoleDAO extends AbstractDAO<Role> {

	public RoleDAO(SessionFactory sessionFactory) {
		super(sessionFactory);
	}

    public Role persist(Role role) {
        return super.persist(role);
    }
    
    public Role findById(Long id) {
        return get(id);
    }
    
    public List<Role> findAll() {
    	return list(currentSession().createQuery("SELECT t FROM Role t"));
    }
    
    public void delete(Long id) {
    	this.currentSession().delete(get(id));
    }
}
